package com.ugoodtech.mdcc.client.controller;

/* Copyright (C) Ugoodtech, Inc - All Rights Reserved.
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 * Proprietary and confidential.
 * Written by Stone Shaw.
 */

import com.ugoodtech.mdcc.client.dto.JsonResponse;
import com.ugoodtech.mdcc.client.service.RequestLogService;
import com.ugoodtech.mdcc.core.domain.RequestLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@Api(description = "request接口")
@RestController
@RequestMapping("/request")
public class RequestController {



    @Autowired
    private RequestLogService requestLogService;

    @ApiOperation("获取request列表")
    @RequestMapping(value = "/getRequests", method = RequestMethod.GET)

    public JsonResponse getRequests(String key, Date stDate, Date edDate, Pageable pageable) {
        Page<RequestLog> requestLogs = requestLogService.queryRequestLog(key,stDate,edDate,pageable);
        return JsonResponse.successResponseWithPageData(requestLogs);
    }

    Logger logger = LoggerFactory.getLogger(RequestController.class);
}
